# coding=utf-8

from flask_wtf import Form
from wtforms import StringField, TextAreaField, PasswordField, BooleanField, SubmitField
from wtforms.validators import Required, DataRequired, Optional, Email, EqualTo


class LoginForm(Form):
    uname = StringField(u"用户名", validators=[DataRequired(message=u"用户名不能为空")])
    pwd = PasswordField(u"密码", validators=[DataRequired(message=u"密码不能为空")])
    btn_login = SubmitField(u"登录")


class UserInfoUpdateForm(Form):
    user_name = StringField(u"账户名", validators=[Optional()])
    user_alias = StringField(u"描述", validators=[Optional()])
    user_email = StringField(u"邮箱", validators=[Optional(), Email(message=u"邮箱格式错误")])
    user_isactive = BooleanField(u"是否激活", validators=[Optional()])
    pwd_is_changed = BooleanField(u"是否修改密码", validators=[Optional()])
    old_pwd = PasswordField(validators=[Optional()])
    new_pwd01 = PasswordField(validators=[Optional(), EqualTo('new_pwd02', message=u"新密码两次输入不一致")])
    new_pwd02 = PasswordField(validators=[Optional()])
    btn_submit = SubmitField(u"更新")